import pygame
from math import pi, sin, cos

data = """
277  306
 282  311
 286  314
 290  314
 291  313
 290  307
 289  299
 284  289
 282  278
 279  266
 278  255
 279  245
 282  236
 288  229
 297  225
 310  222
 325  221
 344  221
 360  223
 375  226
 389  231
 376  304
 368  309
 359  309
 354  301
 350  287
 348  270
 346  249
 345  226
 345  201
 346  179
"""


SCR_SIZE = (600, 600)
BIAS = 20 # pixels


pygame.init()
scr = pygame.display.set_mode(SCR_SIZE)

'''
data = data.strip('\n')
data = data.split('\n')

x0, y0 = data[0].strip(' ').split('  ')
for p in data:
    x, y = p.strip(' ').split('  ')
    x, y = int(x), int(y)
    pygame.draw.line(scr, [255,0,255], (int(x0), 500-int(y0)), (x, 500-y))
    x0, y0 = x, y
    pygame.display.flip()
'''

'''
ctr = (250, 250)  # center
r = 250
pygame.draw.circle(scr, [255]*3, ctr, r, 2)
for i in range(8):
    rad = (i/8.0) * 2*pi
    p = int(250 + r*cos(rad)), 250+int(r*sin(rad))
    print i, rad, cos(rad), sin(rad)
    pygame.draw.line(scr, [255]*3, ctr, p)
'''

data = '0, 39,  2, 62, 11,  5, 63,  0,100, 43, 89, 99, 36,100,  0, 57' #0
data = '57,100, 22, 72,  0, 31, 25,  0, 75, 13,100, 50, 75, 87, 26, 85' #0
#data = '47,100, 27, 81, 57, 37, 26,  0,  0, 23, 56, 53,100, 90, 40, 98' #8
#data = '0, 89, 27,100, 42, 75, 29, 45, 15, 15, 37,  0, 69,  2,100,  6' #2
#data = '0, 57, 31, 68, 72, 90,100,100, 76, 75, 50, 51, 28, 25, 16,  0' #1
#data = '0, 67, 49, 83,100,100, 81, 80, 60, 60, 40, 40, 33, 20, 47,  0' #1
#data = '0, 46, 49, 64, 78, 87,100,100, 91, 75, 85, 49, 75, 24, 89,  0' #1
#data = '100, 84, 31,100,  0, 88,  8, 70, 15, 53, 15, 35,  0, 17,  0,  0' #1
#data = '0,100,  7, 92,  5, 68, 19, 45, 86, 34,100, 45, 74, 23, 67,  0' #4
#data = '11,100,  0, 69, 15, 43, 87, 47,100, 65, 74, 67, 71, 33, 66,  0'#4
#data = '46,100, 10, 83, 34, 64,100, 77, 71, 82, 49, 54, 22, 27,  0,  0'#4
#data = '35, 76, 57,100,100, 92, 68, 66, 81, 38, 82,  9, 32,  0,  0, 17' #3
#data = '50, 84, 66,100, 75, 75, 51, 51,100, 42, 97, 13, 49,  0,  0,  7' #3
#data = '100,100, 72, 99, 36, 78, 34, 54, 79, 47, 64, 13, 19,  0,  0,  2' #5
#data = '12, 77, 20, 62, 78, 40, 50,  0,  1, 17,  0, 64, 23, 98,100,100' #5
#data = '43, 94, 15, 66, 52, 38, 20,  0,  5, 35,  0, 83, 42,100,100, 98' #5
data = '0, 85, 38,100, 81, 88, 87, 50, 84, 12, 58,  0, 53, 22,100, 24 ' #7
data = '0, 98, 36,100, 80, 85, 68, 42, 56,  0, 25, 23, 50, 37,100, 32' #
#data = '74, 87, 31,100,  0, 69, 62, 64,100, 79,100, 38, 84,  0, 18,  1' #9
#data = '91, 74, 54,100,  0, 87, 23, 59, 81, 67,100, 39, 79,  4, 21,  0' #9

data = data.split(',')
points = []
for i in range(8):
    x, y = data[2*i], data[2*i+1]
    points.append((int(x)*5, int(y)*5))


x0, y0 = points.pop(0)
pygame.draw.circle(scr, [255]*3, (x0+BIAS, 500-y0+BIAS), 5)
for x, y in points:
    pygame.draw.line(scr, [255,0,255], (x0+BIAS, 500-y0+BIAS), [x+BIAS, 500-y+BIAS])
    pygame.draw.circle(scr, [255,0,0], (x+BIAS,500-y+BIAS), 5)
    x0, y0 = x, y
    pygame.display.flip()
